package Window;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;

public class NewFrame extends JFrame {

public NewFrame(){



       JMenuBar menubar;
       JMenu menu1,menu2,menu3,menu4;
       JMenuItem item1,item2,item3,item4,item5,item6,item7;
       //NewFrame(String s) {
       // setTitle(s);
        setSize(400, 300);
        setLocation(120, 120);
        setVisible(true);
        menubar = new JMenuBar();
        //menu1 = new JMenu("文件(F)");
        //menu1.setMnemonic('F');
        menu2 = new JMenu("编辑(E)");
        menu2.setMnemonic('F');
       // menu3 = new JMenu("查看(V)");
        //menu3.setMnemonic('V');
       // menu4 = new JMenu("打开(O)");
        //menu4.setMnemonic('O');

        /*item1 = new JMenuItem("查看", new ImageIcon("look.gif"));

        item2 = new JMenuItem("保存", new ImageIcon("save.gif"));
        item2.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK));*/

        item3 = new JMenuItem("增加", new ImageIcon("add.gif"));
        item3.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_MASK));
        item4 = new JMenuItem("修改", new ImageIcon("mod.gif"));
        item4.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, InputEvent.CTRL_MASK));
        item5 = new JMenuItem("删除", new ImageIcon("remove.gif"));
        item5.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.CTRL_MASK));

        //     item6=new JMenuItem("停止",new ImageIcon("stop.gif"));
        //    item6.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T,InputEvent.CTRL_MASK));
        //    item7=new JMenuItem("刷新",new ImageIcon("Snew.gif"));
        //    item7.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N,InputEvent.CTRL_MASK));

       // menu1.add(item1);
      //  menu3.add(new JMenuItem("打开", new ImageIcon("open.gif")));
       // menu1.addSeparator();
        //menu1.add(item2);
        menu2.add(item3);
        menu2.add(item4);
        menu2.add(item5);
        //       menu3.add(item6);
        //       menu3.add(item7);
        //menubar.add(menu1);
        menubar.add(menu2);
        //     menubar.add(menu3);

        setJMenuBar(menubar);
        validate();
        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

 /*item1.addActionListener(new ActionListener() {//对查看按钮添加监听事件

  @SuppressWarnings("deprecation")
  @Override
  public void actionPerformed(ActionEvent arg0) {
   // TODO Auto-generated method stub
   new open();
  }


 });
*/
 item3.addActionListener(new ActionListener() {//对重置按钮添加监听事件

  @SuppressWarnings("deprecation")
  @Override
  public void actionPerformed(ActionEvent arg0) {
   // TODO Auto-generated method stub
   new add();
  }


 });

 item4.addActionListener(new ActionListener() {//对重置按钮添加监听事件

  @SuppressWarnings("deprecation")
  @Override
  public void actionPerformed(ActionEvent arg0) {
   // TODO Auto-generated method stub
   new mod();
  }


 });

 item5.addActionListener(new ActionListener() {//对重置按钮添加监听事件

  @SuppressWarnings("deprecation")
  @Override
  public void actionPerformed(ActionEvent arg0) {
   // TODO Auto-generated method stub
   new remove();
  }


 });
    }

}

       /* this.setBounds(100,100,500,400);
        this.setTitle("欢迎来到新窗口");
        Container s= getContentPane();
        JLabel t=new JLabel("NewFrame");
        s.add(t);
        this.setAlwaysOnTop(true);
        this.setVisible(true);
    */





